﻿using System;
using System.Threading.Tasks;

namespace Linq2Crm.Request.SpecificRequest
{
	public sealed class SettingsRequest : RequestBase
	{
		private SettingsRequest(Type type) : base(type)
		{
		}

		public Action<SettingsResponse> Callback { get; set; }

		public SettingsRequest(Guid userId):this(null)
		{
			UserId = userId;
		}

		public Guid UserId { get; private set; }

		#region Overrides of RequestBase
		internal override void Execute()
		{
			DomainObjectContext.Instance.ExecuteSettingsRequest(this);
		}

		internal override async Task<ResponseBase> ExecuteAsync()
		{
			var reponse = await DomainObjectContext.Instance.ExecuteSettingsRequestAsync(this);
			return reponse;
		}

		#endregion

		public static SettingsRequest Create(Guid userId)
		{
			return new SettingsRequest(userId);
		}
	}
}